<template>
    <div style="height: 100%;position: relative;">
        <div class="main-table">
        </div>
    </div>
</template>

<script>
    export default {
        name: 'uu-table',
        data () {
            const item = {
                date: '2016-05-02',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1518 弄'
            };
            return {
                tableData1: Array(20).fill(item),
                columns: [
                    { prop: 'date', label: '日期', width: 125 },
                    { prop: 'name', label: '姓名', width: 125 },
                    { prop: 'address', label: '地址' },
                    { prop: 'action', label: '操作', scoped: [{ title: '删除', commit:  'delete-row'}, {title: '详情', commit: 'detail-row'}], fixed: 'right', width: 150}
                ],
                formData: {
                    name: { type: 'input', placeholder: '请输入名字', init: '', label: '姓名'},
                    type: { type: 'select', placeholder: '请选择类型', init: 1, label: '类型', options: [{label: '哈哈哈', value: 1}, {label: 'hehehe', value: 2}], value: 'value', name: 'label'},
                    time: { type: 'time', placeholder: '请选择时间', init: '', label: '时间', isRange: true},
                    date: { type: 'date', placeholder: '请选择日期', datetype: 'datetimerange', init: '', label: '日期', isRange: true},
                }
            }
        },
        methods: {
            deleteRow (obj) {
                console.log('删除', obj);
            },
            detailRow (obj) {
                console.log('详情', obj);
            },
            check (obj) {
                console.log(obj)
            }
        },
        created () {

        },
        mounted () {
            this.$nextTick(() => {
                this.formData.type.options = this.formData.type.options.map(item => {
                    item.label = "label" + Math.ceil(Math.random() * 10);
                    return item;
                })
            })
        }
    }
</script>

<style lang="less" scoped>
</style>

